Repository navigation
refactor(server): adapter snapshots stop carrying provider turns nothing reads - #41276
Merged
Merged
Conversation
…ing reads ProviderAdapterV2ThreadSnapshot.providerTurns was produced by every adapter's readThreadSnapshot and rollbackThread but read by no caller; turns reach orchestration as provider_turn.updated events. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ProviderAdapterV2ThreadSnapshot.providerTurnswas filled in by every adapter'sreadThreadSnapshotandrollbackThread, but nothing reads it.AgentSessionImporter, the onlyreadThreadSnapshotcaller, uses justmessagesandreasoningMessageIds.CheckpointRollbackService, the onlyrollbackThreadcaller, uses justproviderThread. Turns reach orchestration asprovider_turn.updatedevents, and the projection'sproviderTurns(which stays) is built from those.What changed
providerTurnsfromProviderAdapterV2ThreadSnapshot.providerTurns: [].providerTurnsmap was only there to feed the snapshot, so it is gone: no field, no init, no write inemitProviderTurn(which also drops its unusedstateparameter), and no pruning loop.rollbackThreadnow returnssnapshotOf(...)as-is, without merging in turns from the caller.Tests
packages/provider-opencode/src/server/adapter.test.ts: about 25 assertions usedsnapshot.providerTurnsto check turn status and ids. They now read the emittedprovider_turn.updatedevents instead. A smalltrackProviderTurns(runtime)helper (also spread into the harness) taps the event stream. ItsawaitTurns/awaitLatestTurnreturn the recorded turns and pull more events only when the ones seen so far don't match.completedAt !== nulland then assert the status.running/failed).OpenCode2AdapterV2.test.ts: dropped the assertions on the returned rollback snapshot's turn ids. Their replay scripts still pin the nativesession.revert.stagetarget, which is the real behavior. Two tests named for the removed pruning are renamed after that revert behavior.AcpAdapterV2.test.ts: the rollback test drops its snapshotproviderTurnsassertions (including the one fix(acp): sessions no longer keep a record of every turn they ran #41256 added) and passesproviderThreadTurns: [].vp run check:changed: format, lint, knip, graphql, typecheck (27 packages) and tests (9 files, 1425 tests) all pass.Done by Claude Opus 5.5 in Claude Code, running inside T3 Code.
🤖 Generated with Claude Code